package com.xncoding.minispring.Listener;

import com.xncoding.minispring.Event.PluginEvent;
import com.xncoding.minispring.inter.Plugin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

/**
 * 在插件中触发自定义事件
 */
@Component
public class MyPlugin implements Plugin {
    @Autowired
    private ApplicationEventPublisher publisher;
    @Override
    public void execute() {
        // 执行插件逻辑
        publisher.publishEvent(new PluginEvent(this));
    }
}